package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                                                                                                                                                                                                                                                                            import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.DateBatchFailLoanMapper;
import com.ruoyi.bizsys.domain.DateBatchFailLoan;
import com.ruoyi.bizsys.service.IDateBatchFailLoanService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 日批失败借据Service业务层处理
 *
 * @author african-loan
 * @date 2021-12-30
 */
@Service
public class DateBatchFailLoanServiceImpl extends ServiceImpl<DateBatchFailLoanMapper,DateBatchFailLoan> implements IDateBatchFailLoanService {

    /**
     * 查询日批失败借据
     *
     * @param id 日批失败借据ID
     * @return 日批失败借据
     */
    @Override
    public DateBatchFailLoan selectDateBatchFailLoanById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询日批失败借据列表
     *
     * @param dateBatchFailLoan 日批失败借据
     * @return 日批失败借据
     */
    @Override
    public List<DateBatchFailLoan> selectDateBatchFailLoanList(DateBatchFailLoan dateBatchFailLoan) {
        return this.list(new QueryWrapper<>(dateBatchFailLoan).last("order by id desc"));
    }

    /**
     * 新增日批失败借据
     *
     * @param dateBatchFailLoan 日批失败借据
     * @return 结果
     */
            @Override
    public int insertDateBatchFailLoan(DateBatchFailLoan dateBatchFailLoan) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            dateBatchFailLoan.setCreateTime(DateUtils.getNowDate());
                                                return baseMapper.insert(dateBatchFailLoan);
    }

    /**
     * 修改日批失败借据
     *
     * @param dateBatchFailLoan 日批失败借据
     * @return 结果
     */
            @Override
    public int updateDateBatchFailLoan(DateBatchFailLoan dateBatchFailLoan) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                dateBatchFailLoan.setUpdateTime(DateUtils.getNowDate());
                            return baseMapper.updateById(dateBatchFailLoan);
    }

    /**
     * 批量删除日批失败借据
     *
     * @param ids 需要删除的日批失败借据ID
     * @return 结果
     */
            @Override
    public int deleteDateBatchFailLoanByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除日批失败借据信息
     *
     * @param id 日批失败借据ID
     * @return 结果
     */
    @Override
    public int deleteDateBatchFailLoanById(Long id) {
        return baseMapper.deleteById(id);
    }

}
